home *** CD-ROM | disk | FTP | other *** search
/ La Traviata / La Traviata.iso / viewer / msgifscn.zip / DEFS.H next >
C/C++ Source or Header  |  1989-05-11  |  10KB  |  327 lines

  1. /*
  2. **
  3. **  Defs.h:  header file for rmail/smail.
  4. **
  5. **  Configuration options for rmail/smail.
  6. **    default configuration is:
  7. **    full domain name is 'hostname.uucp' (get registered!)
  8. **    path file is /usr/lib/uucp/paths.
  9. **    no log, no record, use sendmail.
  10. ** 
  11. **  You can change these in the next few blocks.
  12. **
  13. */
  14.  
  15. /*
  16. **    @(#)defs.h    2.5 (smail) 9/15/87
  17. */
  18.  
  19. #ifndef VERSION
  20. #define    VERSION    "smail2.5"
  21. #endif
  22.  
  23. /*#define BSD                /* if system is a Berkeley system */
  24.  
  25. /*#define SENDMAIL "/usr/lib/mail/execmail" /* Turn off to use /bin/(l)mail only */
  26.  
  27. #ifdef BSD
  28. #define GETHOSTNAME            /* use gethostname() */
  29. #else
  30. #define UNAME                 /* use uname() */
  31. #endif
  32.  
  33. /* if defined, HOSTNAME overrides UNAME and GETHOSTNAME */
  34. #define HOSTNAME    "crdos1"    /* literal name */
  35.  
  36. /*#define HOSTDOMAIN    "host.dom"    /* overrides default HOSTNAME.MYDOM */
  37.  
  38. /*
  39.  * .UUCP here is just for testing, GET REGISTERED in COM, EDU, etc.
  40.  * See INFO.REGISTRY for details.
  41.  */
  42.  
  43. #define MYDOM        ".crd.GE.COM"        /* literal domain suffix */
  44.  
  45. /*
  46.  * WARNING: DOMGATE is only for qualified gateways - use caution.
  47.  * If you don't fully understand it - don't use it!
  48.  * If you are not completely sure you need it - don't use it!
  49.  * If you are not prepared to handle all addresses to MYDOM - don't use it!
  50.  *
  51.  * if defined, DOMGATE (DOMain GATEway) will cause addresses of the form
  52.  *
  53.  *    user@MYDOM or MYDOM!user
  54.  *
  55.  * (with and without the leading '.' on MYDOM)
  56.  * to be seen treated simply 'user' - a purely local address.
  57.  * Then, it is left to the aliasing code to map it back to a
  58.  * non-local address if necessary.
  59.  */
  60.  
  61. /*#define DOMGATE        /* Act as Domain Gateway */
  62.  
  63. /*
  64.  * HIDDENHOSTS allows hosts that serve as domain gateways to hide
  65.  * the subdomains beneath them.  Mail that originates at any of
  66.  * the hosts in the subdomain will appear to come from the gateway host.
  67.  * Hence, mail from
  68.  *
  69.  *         anything.hostdomain!user
  70.  *
  71.  * will appear to come from 
  72.  *
  73.  *         hostdomain!user
  74.  *
  75.  * A consequence is that return mail to hostdomain!user would need to
  76.  * be forwarded to the proper subdomain via aliases or other forwarding
  77.  * facilities.
  78.  *
  79.  * If you're using sendmail, then if defined here,
  80.  * it should be used in ruleset 4 of the sendmail.cf, too.
  81.  */
  82.  
  83. /*#define HIDDENHOSTS            /* hide subdomains of hostdomain */
  84.  
  85. /*
  86.  * Mail that would otherwise be undeliverable will be passed to the
  87.  * aliased SMARTHOST for potential delivery.
  88.  *
  89.  * Be sure that the host you specify in your pathalias input knows that you're
  90.  * using it as a relay, or you might upset somebody when they find out some
  91.  * other way.  If you're using 'foovax' as your relay, and below you have
  92.  * #define SMARTHOST "smart-host", then the pathalias alias would be:
  93.  *
  94.  *    smart-host = foovax
  95.  */
  96.  
  97. #define SMARTHOST  "crdgw1"        /* pathalias alias for relay host */
  98.  
  99. /*
  100. **  ALIAS and CASEALIAS are used only if SENDMAIL is NOT defined.
  101. **  Sites using sendmail have to let sendmail do the aliasing.
  102. **  LOWERLOGNAME maps all local login names into lower case.  This
  103. **  helps sites who have only upper case send mail to mixed case sites.
  104. */
  105.  
  106. #define ALIAS    "/usr/lib/mail/aliases"    /* location of mail aliases       */
  107. /*#define CASEALIAS            /* make aliases case sensitive    */
  108. /*#define LOWERLOGNAME            /* map local logins to lower case */
  109.  
  110. /*
  111.  * defining FULLNAME means that Full Name resolution
  112.  * will be attempted when necessary.
  113.  *
  114.  * the Full Name information will be taken from a
  115.  * list of {Full Name, address} pairs.
  116.  * The names in the list must be sorted
  117.  * without regard to upper/lower case.
  118.  *
  119.  * defining DOT_REQD says that the user name must contain a '.' for
  120.  * the Full Name search to be done.
  121.  *
  122.  * All full name searches are case insensitive.
  123.  *
  124.  */
  125.  
  126. /*#define FULLNAME    "/usr/lib/fullnames"
  127.                     /* list of Full Name, address pairs */
  128.  
  129. /*#define DOT_REQD            /* Must be George.P.Burdell@gatech.EDU
  130.                     ** not just  Burdell@gatech.EDU
  131.                     */
  132.  
  133. /*
  134. **    PATHS is name of pathalias file.  This is mandatory.
  135. **    Define LOG if you want a log of mail.  This can be handy for
  136. **    debugging and traffic analysis.
  137. **    Define RECORD for a copy of all mail.  This uses much time and
  138. **    space and is only used for extreme debugging cases.
  139. */
  140.  
  141. #ifndef PATHS
  142. #define PATHS    "/usr/lib/uucp/paths"    /* location of the path database */
  143. #endif
  144.  
  145. #define LOG    "/usr/spool/uucp/mail.log"    /* log of uucp mail */
  146. /*#define RECORD    "/tmp/mail.log"        /* record of uucp mail */
  147.  
  148. /*
  149. **  Mailer options:
  150. **    RMAIL is the command to invoke rmail on machine sys.
  151. **    RARG is how to insulate metacharacters from RMAIL. 
  152. **    LMAIL is the command to invoke the local mail transfer agent.
  153. **    LARG is how to insulate metacharacters from LMAIL. 
  154. **    RLARG is LARG with host! on the front - to pass a uux addr to sendmail.
  155. **    SENDMAIL selects one of two sets of defines below for either
  156. **    using sendmail or /bin/lmail.
  157. */    
  158.  
  159. #ifndef UUX
  160. #define UUX        "/usr/lib/mail/execmail" /* location of uux command   */
  161. #endif
  162.  
  163. #ifndef SMAIL
  164. #define SMAIL        "/bin/smail"    /* location of smail command */
  165. #endif
  166.  
  167. /*
  168. ** command used to retry failed mail, flag is used to set the routing level.
  169. */
  170. #define VFLAG        ((debug == VERBOSE)?"-v":"")
  171. #define RETRY(flag)    "%s %s %s -f %s ", SMAIL, VFLAG, flag, spoolfile
  172.  
  173. /*
  174. ** use the -a if you have it.  This sometimes helps failed mail and warning
  175. ** messages get back to where the mail originated.
  176. **
  177. ** some versions of uux can't do '-a' - pick one of the next two definitions
  178. */
  179.  
  180. #if 0
  181. #define RMAIL(flags,from,sys) "%s -a%s %s - %s!rmail",UUX,from,flags,sys /* */
  182. /*#define RMAIL(flags,from,sys) "%s %s - %s!rmail",UUX,flags,sys /* */
  183. #else
  184. #define RMAIL(flags,from,sys) "%s -r %s",UUX,from /* */
  185. #endif
  186.  
  187. #define RARG(sys,user)        " '%s!%s'",sys,user
  188. #define RFROM(frm,now,host)     "From %s  %.24s remote from %s\n",frm,now,host
  189.  
  190. #ifdef SENDMAIL
  191.  
  192. #define HANDLE    ALL        /* see HANDLE definition below */
  193. #define ROUTING ALL        /* see ROUTING definition below */
  194.  
  195. #define LMAIL(frm,sys)     "%s -f %s ",SENDMAIL,frm
  196. #define LARG(user)        " '%s'",postmaster(user)
  197. #define RLARG(sys,frm)        " '%s!%s'",sys,frm
  198.  
  199. #else
  200.  
  201. #define HANDLE    ALL
  202. #define ROUTING ALL
  203.  
  204. #ifdef BSD
  205. #define LMAIL(frm,sys)        "/bin/mail"    /* BSD local delivery agent */
  206. #else
  207. #define LMAIL(frm,sys)        "/bin/lmail"    /* SV  local delivery agent */
  208. #endif
  209.  
  210. #define LARG(user)        " '%s'",postmaster(user)
  211. #define RLARG(sys,frm)        " '%s!%s'",sys,frm
  212. #define LFROM(frm,now,host)    "From %s %.24s\n",frm,now
  213.  
  214. #endif
  215.  
  216. /*
  217. **    The following definitions affect the queueing algorithm for uux.
  218. **
  219. **    DEFQUEUE    if defined the default is to queue uux mail
  220. **
  221. **    QUEUECOST    remote mail with a cost of less than QUEUECOST
  222. **            will be handed to uux for immediate delivery.
  223. **
  224. **    MAXNOQUEUE    don't allow more than 'n' immediate delivery
  225. **            jobs to be started on a single invocation of smail.
  226. **    
  227. **    GETCOST        if defined, the paths file will be searched for
  228. **            each address to discover the cost of the route.
  229. **            this allows informed decisions about whether to
  230. **            use the queue flags when calling uux.  The price
  231. **            is in the overhead of a paths file search for
  232. **            addresses that are not going to be routed.
  233. */
  234.  
  235. #define DEFQUEUE            /* default is to queue uux jobs */
  236.  
  237. #define QUEUECOST        100    /* deliver immediately if the cost
  238.                     /* is DEDICATED+LOW or better */
  239.  
  240. #define MAXNOQUEUE        2    /* max UUX_NOQUEUE jobs         */
  241.  
  242. #define GETCOST                /* search for cost        */
  243.  
  244. #define UUX_QUEUE        "-r"    /* uux flag for queueing    */
  245. #define UUX_NOQUEUE        ""    /* uux with immediate delivery    */
  246.  
  247. /*
  248. ** Normally, all mail destined for the local host is delivered with a single
  249. ** call to the local mailer, and all remote mail is delivered with one call
  250. ** to the remote mailer for each remote host.  This kind of 'batching' saves
  251. ** on the cpu overhead.
  252. **
  253. ** MAXCLEN is used to limit the length of commands that are exec'd by smail.
  254. ** This is done to keep other program's buffers from overflowing, or to
  255. ** allow for less intelligent commands which can take only one argument
  256. ** at a time (e.g., 4.1 /bin/mail).  To disable the batching, set MAXCLEN
  257. ** a small value (like 0).
  258. */
  259.  
  260. #define MAXCLEN            128    /* longest command allowed (approx.)
  261.                     /* this is to keep other's buffers
  262.                     ** from overflowing
  263.                     */
  264.  
  265. /*
  266. ** PLEASE DON'T TOUCH THE REST
  267. */
  268.  
  269. #define SMLBUF    512    /* small buffer (handle one item) */
  270. #define BIGBUF    4096    /* handle lots of items */
  271.  
  272. #define MAXPATH    32    /* number of elements in ! path */
  273. #define MAXDOMS    16    /* number of subdomains in . domain */
  274. #define MAXARGS    500    /* number of arguments */
  275. #ifndef NULL
  276. #define NULL    0
  277. #endif
  278.  
  279. #define DEBUG         if (debug==YES) (void) printf
  280. #define ADVISE         if (debug!=NO) (void) printf
  281. #define error(stat,msg,a)    { (void) fprintf(stderr, msg, a); exit(stat); }
  282. #define lower(c)         ( isupper(c) ? c-'A'+'a' : c )
  283.  
  284.  
  285. enum eform {    /* format of addresses */
  286.     ERROR,         /* bad or invalidated format */
  287.     LOCAL,         /* just a local name */
  288.     DOMAIN,     /* user@domain or domain!user */
  289.     UUCP,        /* host!address */
  290.     ROUTE,        /* intermediate form - to be routed */
  291.     SENT        /* sent to a mailer on a previous pass */
  292. };
  293.  
  294. enum ehandle {     /* what addresses can we handle? (don't kick to LMAIL) */
  295.     ALL,        /* UUCP and DOMAIN addresses */
  296.     JUSTUUCP,    /* UUCP only; set by -l  */
  297.     NONE        /* all mail is LOCAL; set by -L */
  298. };
  299.  
  300. enum erouting {    /* when to route A!B!C!D */
  301.     JUSTDOMAIN,    /* route A if A is a domain */
  302.     ALWAYS,        /* route A always; set by -r */
  303.     REROUTE        /* route C, B, or A (whichever works); set by -R */
  304. };
  305.  
  306. enum edebug {    /* debug modes */
  307.     NO,        /* normal deliver */
  308.     VERBOSE,    /* talk alot */
  309.     YES        /* talk and don't deliver */
  310. };
  311.  
  312. #ifdef BSD
  313.  
  314. #include <strings.h>
  315. #include <sysexits.h>
  316.  
  317. #else
  318.  
  319. #include <string.h>
  320. #include "sysexits.h"
  321. #define    index    strchr
  322. #define    rindex    strrchr
  323.  
  324. #endif
  325. extern void exit(), perror();
  326. extern unsigned sleep();
  327.